﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using PeoplesJukebox.Core.MediaItems;
using System.Collections.ObjectModel;
using PeoplesJukebox.Core.MediaItems.Bases;

namespace PeoplesJukebox.Services
{
    /// <summary>
    /// Contract for media catalogue services
    /// </summary>
    [ServiceContract]
    public interface ICatalogueService
    {
        /// <summary>
        /// Returns the <see cref="Artist"/> with the given ID
        /// </summary>
        /// <param name="artistId">Artist ID</param>
        /// <returns>Artist</returns>
        [OperationContract]
        Artist GetArtist(string artistId);

        /// <summary>
        /// Returns the <see cref="Album"/> with the given ID
        /// </summary>
        /// <param name="albumId">Album ID</param>
        /// <returns>Album</returns>
        [OperationContract]
        Album GetAlbum(string albumId);

        /// <summary>
        /// Returns the <see cref="Track"/> with the given ID
        /// </summary>
        /// <param name="trackId">Track ID</param>
        /// <returns>Track</returns>
        [OperationContract]
        Track GetTrack(string trackId);

        /// <summary>
        /// Searches all media items for the given search term
        /// </summary>
        /// <param name="searchTerm">Search term</param>
        /// <returns>Collection of matches</returns>
        [OperationContract]
        Collection<MediaItem> Search(string searchTerm);

        /// <summary>
        /// Gets all the <see cref="Track"/>s for the given <see cref="Artist"/>
        /// </summary>
        /// <param name="artistId">Artist ID</param>
        /// <returns>Collection of tracks</returns>
        [OperationContract]
        Collection<MediaItem> GetArtistTracks(string artistId);

        /// <summary>
        /// Gets all the <see cref="Track"/>s for the given <see cref="Album"/>
        /// </summary>
        /// <param name="albumId">Album ID</param>
        /// <returns>Collection of tracks</returns>
        [OperationContract]
        Collection<MediaItem> GetAlbumTracks(string albumId);

        /// <summary>
        /// Returns all <see cref="Artist"/>s
        /// </summary>
        /// <returns>Collection of artists</returns>
        [OperationContract]
        Collection<MediaItem> GetArtists();

        /// <summary>
        /// Returns all <see cref="Album"/>s
        /// </summary>
        /// <returns>Collection of albums</returns>
        [OperationContract]
        Collection<MediaItem> GetAlbums();

        /// <summary>
        /// Returns all <see cref="Track"/>s
        /// </summary>
        /// <returns>Collection of tracks</returns>
        [OperationContract]
        Collection<MediaItem> GetTracks();

        /// <summary>
        /// Returns a collection of randomly-chosen <see cref="Track"/>s
        /// </summary>
        /// <param name="count">Number of random tracks to return</param>
        /// <returns>Collection of tracks</returns>
        [OperationContract]
        Collection<MediaItem> GetTrackSuggestions(string count);

        /// <summary>
        /// Returns <see cref="Artist"/>s with names matching search criteris
        /// </summary>
        /// <param name="artistName">Name to search for</param>
        /// <returns>Collection of artists</returns>
        [OperationContract]
        Collection<MediaItem> SearchArtists(string artistName);

        /// <summary>
        /// Returns <see cref="Album"/>s with names matching search criteris
        /// </summary>
        /// <param name="artistName">Name to search for</param>
        /// <returns>Collection of albums</returns>
        [OperationContract]
        Collection<MediaItem> SearchAlbums(string albumName);

        /// <summary>
        /// Returns <see cref="Tracks"/>s with names matching search criteris
        /// </summary>
        /// <param name="artistName">Name to search for</param>
        /// <returns>Collection of tracks</returns>
        [OperationContract]
        Collection<MediaItem> SearchTracks(string trackName);
    }
}
